package com.boe.hbd.client.activity;

import com.boe.hbd.client.Constants;
import com.boe.hbd.client.R;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

public class LandscapeTabActivity extends TabActivity {
	public void onCreate(Bundle theInstance) {
		super.onCreate(theInstance);
		setContentView(R.layout.landscape_tab_activity);
		Resources res = getResources();
		TabHost tabHost = getTabHost();
		TabHost.TabSpec spec;
		Intent intent;

		int requestCode = getIntent().getExtras().getInt(Constants.ACTIVITY_REQUEST_CODE) ;
		
		intent = new Intent().setClass(this, LandscapeIntroductionActivity.class);
		intent.putExtras(getIntent());
		spec = tabHost.newTabSpec(LandscapeIntroductionActivity.class.getSimpleName())
		        .setIndicator(getString(R.string.introduction), res.getDrawable(R.drawable.introduction)).setContent(intent);
		tabHost.addTab(spec);

		if ( requestCode != Constants.ACTIVITY_REQUEST_CODE_ADD_LANDSCAPE ) {
			intent = new Intent().setClass(this, LandscapeCommentsActivity.class);
			intent.putExtras(getIntent());
			spec = tabHost.newTabSpec(LandscapeCommentsActivity.class.getSimpleName())
			        .setIndicator(getString(R.string.comments), res.getDrawable(R.drawable.addcomment)).setContent(intent);
			tabHost.addTab(spec);
	
			intent = new Intent().setClass(this, LandscapeVoicesActivity.class);
			intent.putExtras(getIntent());
			spec = tabHost.newTabSpec(LandscapeVoicesActivity.class.getSimpleName())
			        .setIndicator(getString(R.string.voices), res.getDrawable(R.drawable.recordvoice)).setContent(intent);
			tabHost.addTab(spec);
	
			intent = new Intent().setClass(this, LandscapePhotosActivity.class);
			intent.putExtras(getIntent());
			spec = tabHost.newTabSpec(LandscapePhotosActivity.class.getSimpleName())
			        .setIndicator(getString(R.string.photos), res.getDrawable(R.drawable.takephoto)).setContent(intent);
			tabHost.addTab(spec);
		}
		
		switch (getIntent().getExtras().getInt(Constants.ACTIVITY_REQUEST_CODE)) {
		    case Constants.ACTIVITY_REQUEST_CODE_ADD_LANDSCAPE: {
			    tabHost.setCurrentTab(0);
		    }
			break;
		    case Constants.ACTIVITY_REQUEST_CODE_VIEW_LANDSCAPE_COMMENTS: {
			    tabHost.setCurrentTab(1);
		    }
			break;
		    case Constants.ACTIVITY_REQUEST_CODE_LISTEN_LANDSCAPE_VOICE: {
			    tabHost.setCurrentTab(2);
		    }
			break;
			case Constants.ACTIVITY_REQUEST_CODE_SEE_LANDSCAPE_PHOTOS: {
			    tabHost.setCurrentTab(3);
		    }
			break;
		}
	}
	 
}
